<?php

/**
 * @author @author Samrat Khan & Sadik Sarfaraz - May 19, 2013
 */
require 'top.inc.php';
$formLoad = new Form();
if(isset($_SESSION['user']) && $_SESSION['user']['utype'] == 1 || $_SESSION['user']['utype'] == 2 || $_SESSION['user']['utype'] == 3 || $_SESSION['user']['utype'] == 4) {
    $sess_cusID = $_SESSION['user']['cus_id'];
?>
<form name="addStockOut" id="addStockOut" method="post">
<?php
echo "<table class=\"form-inline row-fluid table table-striped table-bordered\">";
    echo "<tr>";
        echo "<th>" . $stock_out['serialno'] . "</th>";
        echo "<th>" . $stock_out['project_id'] . "</th>";
        echo "<th>" . $stock_out['productid'] . "</th>";
        echo "<th>" . $stock_out['description'] . "</th>";
        echo "<th>" . $stock_out['revisionstate'] . "</th>";
        echo "<th>" . $stock_out['eng_id'] . "</th>";
        echo "<th>" . $stock_out['responsetype'] . "</th>";
        echo "<th>" . $stock_out['requesttime'] . "</th>";
        echo "<th>" . $stock_out['out_docketnumber'] . "</th>";
        echo "<th>" . $stock_out['out_quantity'] . "</th>";
        echo "<th>" . $stock_out['uom'] . "</th>";
        echo "<th>" . $stock_out['requestnumber'] . "</th>";
        echo "<th>" . $stock_out['requestedby'] . "</th>";
        echo "<th>" . $stock_out['siteid'] . "</th>";
        echo "<th>" . $stock_out['boxno'] . "</th>";
        echo "<th>" . $stock_out['warehouseid'] . "</th>";
        echo "<th>" . $stock_out['challannumber'] . "</th>";
        echo "<th>" . $stock_out['receivedtime'] . "</th>";
        echo "<th>" . $stock_out['deliverytime'] . "</th>";
        echo "<th>" . $stock_out['sla'] . "</th>";
        echo "<th>" . $stock_out['receivername'] . "</th>";
        echo "<th>" . $stock_out['cellnumber'] . "</th>";
        echo "<th>" . $stock_out['transportername'] . "</th>";
        echo "<th>" . $stock_out['employee_id'] . "</th>";
        echo "<th>" . $stock_out['remarks'] . "</th>";
        echo "<th>" . "&nbsp;" . "</th>";
    echo "</tr>";
    
    echo "<tr>";
        echo "<td>" . $formLoad->textField('serialno', "", "stockout_serial", $stock_out['serialno']) . "</td>";
        echo "<td>";
            echo "<select name='project_id'>";
                echo getProjects(cus_id, $sess_cusID, $db);
            echo "</select>";
        echo "</td>";
        echo "<td>" . $formLoad->textField('productid', "", "productid", $stock_out['productid']) . "</td>";
        echo "<td>" . $formLoad->textArea("description", "", "description") . "</td>";
        echo "<td>" . $formLoad->textField('revisionstate', "", "revisionstate", $stock_out['revisionstate']) . "</td>";
        echo "<td>";
            echo "<select name='eng_id' id='eng_id'>";
                echo getEngineers($db);
            echo "</select>";
        echo "</td>";
        echo "<td>";
            echo "<select name='response_type_id' id='response_type_id'>";
                echo getResponseTypes($sess_cusID, $db);
            echo "</select>";
        echo "</td>";
        echo "<td>" . $formLoad->textFieldDate('requesttime', "input-append date", "requesttime", $stock_out['requesttime']) . "</td>";
        echo "<td>" . $formLoad->textField('out_docketnumber', "", "out_docketnumber", $stock_out['out_docketnumber']) . "</td>";
        echo "<td>" . $formLoad->textField('out_quantity', "out_quantity", "out_quantity", $stock_out['out_quantity']) . "</td>";
        echo "<td>";
            echo "<select name='uom' id='uom'>";
                echo getUOM($db);
            echo "</select>";
        echo "</td>";
        echo "<td>" . $formLoad->textField('requestnumber', "", "requestnumber", $stock_out['requestnumber']) . "</td>";
        echo "<td>" . $formLoad->textField('requestedby', "", "requestedby", $stock_out['requestedby']) . "</td>";
        echo "<td>" . $formLoad->textField('siteid', "", "siteid", $stock_out['siteid']) . "</td>";
        echo "<td>" . $formLoad->textField('boxno', "", "boxno", $stock_out['boxno']) . "</td>";
        echo "<td>";
            echo "<select name='warehouse_id' id='warehouse_id'>";
                echo getWarehousesCode($db);
            echo "</select>";
        echo "</td>";
        echo "<td>" . $formLoad->textField('challannumber', "", "challannumber", $stock_out['challannumber']) . "</td>";
        echo "<td>" . $formLoad->textFieldDate('receivedtime', "input-append date", "receivedtime", $stock_out['receivedtime']) . "</td>";
        echo "<td>" . $formLoad->textFieldDate('deliverytime', "input-append date", "deliverytime", $stock_out['deliverytime']) . "</td>";
        echo "<td>" . $formLoad->textFieldReadyOnly("sla", "", "sla", "readonly", $stock_out['sla']) . "</td>";
        echo "<td>" . $formLoad->textField('receivername', "", "receivername", $stock_out['receivername']) . "</td>";
        echo "<td>" . $formLoad->textField('cellnumber', "", "cellnumber", $stock_out['cellnumber']) . "</td>";
        echo "<td>" . $formLoad->textField("transportername", "", "transportername", $stock_out['transportername']) . "</td>";
        echo "<td>";
            echo "<select name='employee_id' id='employee_id'>";
                echo getEmployees($db);
            echo "</select>";
        echo "</td>";
        echo "<td>" . $formLoad->textArea("remarks", "", "remarks") . "</td>";
        echo '<input type="hidden" name="userid" value="'.$_SESSION['user']['id'].'" />';
        echo '<input id="stockin_id" type="hidden" name="stockin_id" value="" />';
        echo '<input id="balancestock" type="hidden" name="balancestock" value="" />';
        echo '<input type="hidden" name="cus_id" value="'.$_SESSION['user']['cus_id'].'" />';
        echo '<input type="hidden" name="session_id" value="'.  session_id() .'" />';
        echo '<input type="hidden" name="junkentry" value="0" />';
        echo "<td>";
            echo '<input id="AddStockOutBtn" class="btn btn-primary" type="submit" value="Add Item" name="addStockOut" />';
        echo "</td>";
    echo "</tr>";
echo "<table>";
?>
</form>

<div id="show"></div>
<?php
}
include 'bottom.inc.php';
?>